import React, { Component } from 'react';
import DemoC1 from './Child';
class DemoP1 extends Component {
  state = { 
    price:8888
   }
  //  修改电脑的价钱
  updatePrice = (price)=> {
    this.setState({
      price
    })
   }
  render() { 
    return ( <>
      <h3>7.2子组件给父子组件传值</h3>
      <p>父组件</p>
      戴尔G15 5511的价钱是：{this.state.price}
      <DemoC1 updatePrice={this.updatePrice} price={this.state.price}/>
    </> );
  }
}
 
export default DemoP1;